Repository navigation
Feature/issue 297 identity match mode - #298
Merged
Merged
Conversation
- IFlowOperator 新增 default getIdentity()/getIdentityAttributes(),下游存量实现零改动即可编译 - 新增 OperatorIdentity:null 与空串统一归一化为默认身份,供全链路比较与存储复用 - FlowRecord 增加发起/提交/当前/转交/干预五组身份字段,FlowTodoRecord 增加三组身份字段 - FlowRecordEntity/FlowTodoRecordEntity 与 Convertor 双向映射,历史数据 identity 为 null 时读取归一化为空串 - GroovyScriptRequest 暴露 getCreatedOperatorIdentity/getCurrentOperatorIdentity/getSubmitOperatorIdentity - FlowOperator 响应体携带身份,保留 (id, name) 双参构造器保证下游源码兼容 - P1 不改变任何判定逻辑与待办合并键格式,identity 为空时行为与历史一致 Closes #288
P2 透传与隔离: - FlowOperatorGateway 新增 default get(id, identity),下游存量实现零改动;IRepositoryHolder 同步新增 getOperatorById(id, identity) - FlowOperatorLocalThreadCache 缓存键由 userId 升级为 (userId, identity),同一人两个身份不再串味 - 请求体统一支持 operatorIdentity:create/action/revoke/delete/urge/detail/processNodes/reissue/forceSync/subProcessReset - REST 层新增 operatorIdentity 参数(与 operatorId 对称),未传时取当前登录操作者身份 - getTodoKey 采用兼容追加策略:默认身份保持历史格式,非空身份追加 #identity,升级中的存量待办合并关系不断裂 - 待办/已办/抄送查询按 (operatorId, identity) 过滤,默认身份用 coalesce(identity,'') 覆盖历史 NULL 行 - FlowRecordContent 列表响应补充发起/提交/当前三组身份,供前端列表展示 P3 判定升级为 (userId, identity): - WorkflowStrategyManager.verifyOperator 增加身份比较(审批参与人校验) - 撤销/删除/催办/子流程重置的记录归属校验加入身份 - OperatorManager(加签/减签/转交/委托)按人员+身份匹配 - 加签待办队列查重、减签目标解析按 (userId, identity) 去重 - 提交人==审批人的自动通过判定、流程干预人识别加入身份 - 详情/流程树/延迟触发/子流程会话/转交/delegate 等按记录身份回查操作者 文档与升级: - 新增 docs/Integration/operator-identity.md(模型、SPI、请求参数、脚本用法、兼容性与限制) - 新增 docs/Integration/sql/0.3.0-operator-identity.sql(加列 + 索引建议 + 达梦说明 + 自检 SQL) - 示例工程 FlowOperatorGatewayImpl/User 提供身份参考实现(返回带身份的副本,避免污染持久化上下文) 验证:./mvnw clean install 全量通过,453 个用例 0 失败(framework 430 / infra 6 / api 2 / starter 8 / example 7)。 新增用例 13 个:待办合并键身份维度 4、缓存身份隔离 4、审批判定身份 3、待办查询身份隔离(含历史 NULL)2。 Closes #288
- IBeanFactory / FlowScriptContext 新增 getOperatorById(userId, identity),default 实现走 GatewayContext - GroovyScriptBind 新增 $bind.getOperatorByIdentity(userId, identity),脚本可让指定人员以指定身份参与, 例如审批人脚本返回 [$bind.getOperatorByIdentity(2, 'department1')] - 文档补充脚本用法示例
基于 PR #289 的评审结论,修复 6 个衍生问题并补齐用例: #290 详情页 currentNodeOperators 改为按 (人员id, 身份) 复合键去重, 排除当前操作人时也同时比较身份,避免同一人的第二个身份被吞掉。 #291 Mock 待办 / 已办 / 抄送查询补齐身份隔离重载,与真实 JPA 口径一致 (历史 NULL 身份按默认身份命中),带 mockKey 的联调不再串味。 #292 人员指定支持 (人员id, 身份) 二元组:新增 OperatorKey 与 operatorSelectOperators,分配表 JSON 兼容 [1,2,3] 与对象数组两种格式, 无需新增列 / DDL;PassAction 与 InitiatorSelectNodeService 统一用 hasAssignment 判定,兼容存量 map、新字段及发起时已落库的分配; 二次发起连同身份一起复制。 #293 网关与仓储持有者补批量取人身份重载,线程缓存按 (id, identity) 隔离; 流程树改为按记录身份分组预加载,消除多身份场景的 N+1 回查。 #294 新增 OperatorIdentity.validate(长度 64 / 禁止 # 与控制字符), 实体列宽与 DDL 对齐;落库前校验、读取仍宽松; 新增 OperatorIdentityGuard 对身份静默降级输出去重 WARN; clearNotify 同步清理 forwardOperatorIdentity。 #295 新增 25 个用例:多身份真实流程、Mock 查询隔离、脚本按身份取人、 批量身份缓存、身份校验与告警、转交身份清理、当前节点待审批人。 全量 478 用例 0 失败(原 453)。 文档:operator-identity.md 补充批量重载、人员指定、Mock 口径与写入约束; 升级 SQL 说明人员分配表无需改表。 Refs #290, #291, #292, #293, #294, #295
- 移除 IFlowOperator#getIdentityAttributes 扩展点及对应测试断言 - 示例用户实体 identity 字段改为持久化,不再标记 @transient - 更新 flow-frontend 子模块指针
- 批量取人:下游未覆盖 findByIds(ids, identity) 时逐条回退到按身份单条取人, 身份不符的结果不再登记线程缓存,避免污染同线程后续按身份的读取 (示例工程只覆盖单条 get 时会静默丢失身份,现已由用例守住) - 发起 / 审批入口补 OperatorIdentityGuard 降级告警 - REST 入口:operatorIdentity 参数在入口校验;覆盖 operatorId 时不再继承登录用户身份, 避免「目标人员 + 登录人身份」错配 - 示例:User.identity 恢复 @transient(运行期身份),网关补 findByIds(ids, identity) 参考实现 - 文档:清理已移除的 getIdentityAttributes,补「启用身份的时机」迁移指引与示例验证步骤
- 新增 IdentityDemoInitializer:首次启动创建演示账号 user1/user2(密码 123456)与 流程 identity-demo,并以三种身份组合各发起一条流程,把待办投给 「张三·默认身份」「张三·department1」「李四·department2」 - 幂等:流程编码已存在时跳过;可通过 flow.example.identity-demo-enabled=false 关闭 - AdminInitializer 显式 @order(10),保证 admin 先于依赖它的初始化器创建 - 文档 5.2 补充演示账号、验证步骤与前端 dev 启动方式
- 新增 5.3:发起人设定审批人只带人员 id(OperatorKey.ofDefault),不继承发起人身份, 导致「审批人是 admin 却看不到待办」;给出排查顺序与 OperatorKey.of 带身份的写法 - 记录前端接入约定:身份参数只注入 /api/ 前缀的引擎接口,避免污染宿主接口的查询参数解析
- 新增 OperatorIdentityMatchMode(STRICT / USER_ONLY)与 OperatorIdentityPolicy,收口审批、撤回、催办、删除、子流程重置、减签、干预留痕、同人自动通过、详情页待审批人匹配等判定 - starter 新增 FlowProperties(codingapi.flow.identity.match-mode,默认 USER_ONLY),启动时由 OperatorIdentityPolicyRegister 写入 framework;framework 默认仍为 STRICT - 查询接口新增 identityScope(ALL / LOCKED,默认 ALL),operatorIdentity 不再隐式过滤,前端携带身份不会导致待办消失 - 文档补充查询范围、判定模式与留痕口径;新增策略与跨身份办理单测
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev #298 +/- ##
============================================
+ Coverage 74.30% 76.16% +1.85%
- Complexity 2004 2123 +119
============================================
Files 270 282 +12
Lines 8256 8648 +392
Branches 981 1027 +46
============================================
+ Hits 6135 6587 +452
+ Misses 1630 1552 -78
- Partials 491 509 +18 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- operator-identity:补查询范围(identityScope)、判定模式(USER_ONLY/STRICT)口径,修正过渡建议与 3.3 请求示例,补充自定义 FlowRecordQueryService 未覆盖身份重载会导致 LOCKED 静默退化 - rest-api:补 operatorIdentity 解析规则、查询身份范围参数表、FlowRecordQueryService 身份重载说明 - auto-configuration:补 OperatorIdentityPolicyRegister 与 SpringFlowEventPublisher、配置项 codingapi.flow.identity.match-mode,修正条件注解描述 - capabilities/gateway-context:补多身份需覆盖的网关 default 重载 - Integration/README:更新文档索引描述与 Bean/Register 数量
This was referenced Dec 2, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.